package com.zzedu.enmuns;

import java.util.Arrays;

/**
 * 频率
 */
public enum FrequencyEnum {
    /**
     * 1周1次
     */
    ONE(1, "1周1次"),

    /**
     * 1周2次
     */
    TWO(2, "1周2次"),

    ;
    private final int code;

    private final String desc;

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    FrequencyEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static FrequencyEnum getCode(int code) {
        return Arrays.stream(FrequencyEnum.values()).filter(e -> e.getCode() == code).findFirst().orElse(null);
    }
}
